from optparse import OptionParser
from recovery.custom_db_replicator import Replicator
from swift.common import db
from swift.account import server as account_server
from swift.common.utils import parse_options
from swift.common.daemon import run_daemon

class AccountReplicator(Replicator):
    server_type = 'account'
    brokerclass = db.AccountBroker
    datadir = account_server.DATADIR
    default_port = 6000


if __name__ == "__main__":
    parser = OptionParser("%prog CONFIG [options]")
    parser.add_option('-d', '--device',
                      help='Replicate only given devices. '
                           'Comma-separated list')
    parser.add_option('-p', '--partitions',
                      help='Replicate only given partitions. '
                           'Comma-separated list')

    conf_file, options = parse_options(parser=parser, once=True)
    run_daemon(AccountReplicator, conf_file, **options)
